#include "manano_common.h"

#include "mdtx-online/indicator/indicator_type_s4.h"
namespace indi = mdtx::online::indicator;

using rollmoment = unary4<indi::rollmoment>;
using rollmoment_cu = unary4<indi::rollmoment_cu>;

void bind_indi_s4(py::module &m)
{
    auto mod = m.def_submodule("moment", "Rolling central moments");
    {
        auto v = py::class_<rollmoment>(mod, "rolling")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rollmoment::run, py::arg("x"),
                     R"mydoc(
                        Run calculation
                        Args:
                           x (float64) : input data
                        Return:
                           mean (float64)
                           M2 (fload64)
                           M3 (float64)
                           M4 (float64))mydoc")
                     .def("run", &rollmoment::run2, py::arg("x"),
                     R"mydoc(
                        Run calculation
                        Args:
                           x (numpy.array) : input data
                        Return:
                           mean (numpy.array)
                           M2 (numpy.array)
                           M3 (numpy.array)
                           M4 (numpy.array))mydoc");
        v.doc() = R"mydoc(
                    Rolling central moments (4th order)
                    Args:
                        period (int) : rolling window period)mydoc";
    }
    {
        auto v = py::class_<rollmoment_cu>(mod, "cumulative")
                     .def(py::init())
                     .def("run", &rollmoment_cu::run, py::arg("x"),
                     R"mydoc(
                        Run calculation
                        Args:
                           x (float64) : input data
                        Return:
                           mean (float64)
                           M2 (fload64)
                           M3 (float64)
                           M4 (float64))mydoc")
                     .def("run", &rollmoment_cu::run2, py::arg("x"),
                     R"mydoc(
                        Run calculation
                        Args:
                           x (numpy.array) : input data
                        Return:
                           mean (numpy.array)
                           M2 (numpy.array)
                           M3 (numpy.array)
                           M4 (numpy.array))mydoc");
        v.doc() = R"mydoc(
                    Cumulative central moments (4th order))mydoc";
    }
}
